const express = require('express');
const router = express.Router();
const department_handler = require('../router_handler/department');

const expressJoi = require('@escook/express-joi');
const { 
	addDepartment_schema,
	addDepartmentSon_schema,
	startDepartment_schema,
	deleteDepartment_schema,
	deleteDepartmentSon_schema,
	updateDepartment_shcema,
	updateDepartmentSon_shcema,
} = require('../schema/department');

// 添加一级部门
router.post('/addDepartment', expressJoi(addDepartment_schema), department_handler.addDepartment);
// 添加二级部门
router.post('/addDepartmentSon', expressJoi(addDepartmentSon_schema), department_handler.addDepartmentSon);
// 禁用启用
router.post('/startDepartment', expressJoi(startDepartment_schema), department_handler.startDepartment)
// 删除一级部门
router.post('/deleteDepartment', expressJoi(deleteDepartment_schema), department_handler.deleteDepartment);
// 删除二级部门
router.post('/deleteDepartmentSon', expressJoi(deleteDepartmentSon_schema), department_handler.deleteDepartmentSon);
// 批量删除部门
router.post('/deleteDepartmentList', department_handler.deleteDepartmentList)
// 修改一级部门
router.post('/updateDepartment', expressJoi(updateDepartment_shcema), department_handler.updateDepartment);
// 修改二级部门
router.post('/updateDepartmentSon', expressJoi(updateDepartmentSon_shcema), department_handler.updateDepartmentSon);
// 查询部门
router.get('/getDepartment', department_handler.getDepartment);
// 选择框查询部门
router.get('/getDepartmentList', department_handler.getDepartmentList);

module.exports = router;